$(function() {
	// body...
    localStorage.indexName = titleIndex;
    

	$.ajax({
        url: severUrl+'index.php?m=Web&a=research',
        type: 'GET',
        dataType: 'JSONP'
    })
    .done(function(data) {
        console.log("success");
        console.log(data);
        focusFun(data.focus)
        // BusinessMapFun(data.locations)

    })
    .fail(function() {
        console.log("error");
    })
    .always(function() {
        console.log("complete");
    });
})




// focus
 function focusFun(data){
 	var focusCon = $('#focusCon');
 	var  html = '' ;
 	for (var i = 0; i < data.length; i++) {
 		var cn = '<li><a href="javascript:void(0);">'+
						'<div class="imgC">'+
							'<img class="photo" data-in="'+i+'" src="'+data[i].image_url+'">'+
							'<div class="men"><p>'+data[i].describe+'</p><span class="iconCn"><i class="iconfont">&#xe601;</i></span></div>'+
						'</div>'+
						'<div class="title">'+data[i].title+'</div>'+
					'</a></li>';
		html+=cn;
 	}
 	focusCon.html(html)
    PhotosFrameFunTwo();

 }
// focus end




//第一个 样式改变 end

//PHOTOS 弹出 相框 
function PhotosFrameFunTwo(){
    var Con = $('#PhotosFrame');
    var Exit = $('#ExitPhotosFrame');
    var next = Con.find('.nextFrame');
    var prev = Con.find('.prevFrame');
    var imgCon = Con.find('.imgCon');

    var NCon = $('#focusCon');
    var img = NCon.find('img.photo');
    

    var Dataimg = [];
    var index = 0;

    for (var i = 0; i < img.length; i++) {

        Dataimg[i] = img.eq(i).attr('src');
    }

    // console.log(Dataimg);
    // console.log(Dataimg.length);

    NCon.on('click','span.iconCn',function(){
        index =  parseInt($(this).parents('a').find('img').attr('data-in'));
        imgCon.find('img').attr('src',Dataimg[index]);




        Con.show();
        setTimeout(function(){
            imgCon.addClass('active')
        },1)

    })

    next.click(function(){
        index--;
        if (index < 0) {
            index = (Dataimg.length - 1);
        }
        console.log(index)
        imgCon.find('img').attr('src',Dataimg[index]);
    })
    
    prev.click(function(){
        index++;
        if (index >(Dataimg.length - 1)) {
            index = 0;
        }
        console.log(index)

        imgCon.find('img').attr('src',Dataimg[index]);
    })

    Exit.click(function(){
        imgCon.removeClass('active')
        setTimeout(function(){
            Con.hide();
        },300)
    })
}
// PhotosFrameFunTwo();

//PHOTOS 弹出 相框 end